/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.worldwizards;

import com.hero.HeroDesigner;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

/**
 *
 * @author Jeff Kesselman
 */
public class HDInfoPlugin {
     HeroDesigner hdesigner = HeroDesigner.getInstance();
     InfoPanel chartPanel = null;
     
     public HDInfoPlugin() {
         JMenuBar menubar = hdesigner.getMainMenuBar();
         JMenu menu=null;
         for (int i=0;i<menubar.getMenuCount();i++){
             menu = menubar.getMenu(i);
             if (menu.getText().equalsIgnoreCase("tools")){
                 break;
             }
         }
         if (menu.getText().equalsIgnoreCase("tools")){
             JMenuItem chartItem = new JMenuItem("Info");
             chartItem.addActionListener(new ActionListener(){

                public void actionPerformed(ActionEvent e) {
                    showChartPanel();
                }

                
            });
             menu.add(chartItem);
         }
     }
     
     private void showChartPanel() {
        if (chartPanel == null){
            chartPanel = new InfoPanel(HeroDesigner.getAppFrame());
        }
        chartPanel.setVisible(true);
     }
     
     public static void main(String[] args) { 
        System.out.println("Hellow World");
        new HDInfoPlugin();
        
       
    }
}
